package com.jxnu.duewang.zmly.zouZhen.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.jxnu.duewang.zmly.fragment.BaseFragment;

import java.util.List;

/**
 * Project Zmly
 * Author Duewang
 * Time 2016/12/5 0005
 */

public class CommonFragmentAdapter extends FragmentPagerAdapter {

    private List<BaseFragment> mFragments;

    public CommonFragmentAdapter(FragmentManager fragmentManager,List<BaseFragment> baseFragments){
        super(fragmentManager);
        mFragments=baseFragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        int ret=0;
        if (mFragments != null) {
            ret=mFragments.size();
        }
        return ret;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mFragments.get(position).getFragmnetTitle();
    }

}
